﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Web.Framework.Encrypt;

namespace ApiAuth.Services
{
    public static class ApiCommon
    {
        public static string HashPassword(string password, string salt)
        {
            string strToHash = password + salt.ToLower();
            string hash = Convert.ToBase64String(System.Security.Cryptography.MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(strToHash)));
            return hash;
        }

        public static string Encrypt(string text)
        {
            return EncryptHelper.Encrypt(text, "apipassword");
        }

        public static string Decrypt(string cypherText)
        {
            return EncryptHelper.Decrypt(cypherText, "apipassword");
        }
    }
}
